
#include "xmodule_config.h"


#if MODULE_CHECK_ENABLED( ACCELERATOR )

#include <string.h>

const em_accel_instance_t* ACCEL_SENSOR_LIST[] = 
{
    
#if KX022_CONFIG_ENABLE
    &kx022,
#endif 

#if SC7A20_CONFIG_ENABLE
    &sc7a20,
#endif

#if STK8321_CONFIG_ENABLE
    &stk8321,
#endif

};

int em_accelerator_list_get_count(void)
{
    return sizeof(ACCEL_SENSOR_LIST) /sizeof(ACCEL_SENSOR_LIST[0]);
}

const em_accel_instance_t* em_accelerator_list_mounting( em_accel_desc_t* p_desc )
{
    em_accel_desc_t desc;
    for( int i = 0; i < sizeof(ACCEL_SENSOR_LIST) /sizeof(ACCEL_SENSOR_LIST[0]); i ++ )
    {
        if( ACCEL_SENSOR_LIST[i]->mounting( &desc ) )
        {
            if( p_desc != NULL )
            {
                *p_desc = desc;
            }
            return ACCEL_SENSOR_LIST[i];
        }
    }
    return NULL;
}
#endif 
